const Joi = require('joi');

const login = {
  body: Joi.object().keys({
    username: Joi.string().required(),
    password: Joi.string().required(),
  }),
};

const createAdmin = {
  body: Joi.object().keys({
    username: Joi.string().required(),
    password: Joi.string().required(),
    name: Joi.string().required(),
    role: Joi.string().valid('超级管理员', '内容管理员', '用户管理员'),
    permissions: Joi.array().items(Joi.string()),
    isActive: Joi.boolean(),
  }),
};

const getAdmin = {
  params: Joi.object().keys({
    adminId: Joi.string().required(),
  }),
};

const updateAdmin = {
  params: Joi.object().keys({
    adminId: Joi.string().required(),
  }),
  body: Joi.object()
    .keys({
      username: Joi.string(),
      password: Joi.string(),
      name: Joi.string(),
      role: Joi.string().valid('超级管理员', '内容管理员', '用户管理员'),
      permissions: Joi.array().items(Joi.string()),
      isActive: Joi.boolean(),
    })
    .min(1),
};

const deleteAdmin = {
  params: Joi.object().keys({
    adminId: Joi.string().required(),
  }),
};

module.exports = {
  login,
  createAdmin,
  getAdmin,
  updateAdmin,
  deleteAdmin,
}; 